# [ Density Animation ]

	# [ LOOP 30 TIMES ]
		execute as @e[tag=DENSITY] at @s if score #Density Frame matches 1 if score @s ID = @p ID run title @p times 0 10s 5t
		execute as @e[tag=DENSITY] at @s if score #Density Frame matches 1 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0001"}
		execute as @e[tag=DENSITY] at @s if score #Density Frame matches 2 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0002"}
		execute as @e[tag=DENSITY] at @s if score #Density Frame matches 3 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0003"}
		execute as @e[tag=DENSITY] at @s if score #Density Frame matches 3 run scoreboard players add #Density_LOOP_1 Frame 1
		execute as @e[tag=DENSITY] at @s if score #Density Frame matches 3 if score #Density_LOOP_1 Frame matches 1..30 run scoreboard players set #Density Frame 0
		
		
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 4 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0004"}
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 5 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0005"}
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 6 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0006"}
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 7 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0007"}
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 8 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0008"}
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 9 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0009"}
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 10 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0010"}
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 11 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0011"}
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 12 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0012"}
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 13 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0013"}
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 14 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0014"}
	
	# [ LOOP 800 TIMES ]
		execute as @e[tag=DENSITY] at @s if score #Density Frame matches 15 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0015"}
		execute as @e[tag=DENSITY] at @s if score #Density Frame matches 16 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0016"}
		execute as @e[tag=DENSITY] at @s if score #Density Frame matches 17 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0017"}
		execute as @e[tag=DENSITY] at @s if score #Density Frame matches 17 run scoreboard players add #Density_LOOP_2 Frame 1
		execute as @e[tag=DENSITY] at @s if score #Density Frame matches 17 if score #Density_LOOP_2 Frame matches 1..800 run scoreboard players set #Density Frame 14
		
		# [ Kill the player if he didnt do the objective ]
			execute as @e[tag=DENSITY] at @s if score #Density Frame matches 17 if entity @e[tag=SAVETHEM] if score @s ID = @e[tag=SAVETHEM,limit=1,sort=nearest] ID if score @s ID = @p ID run title @p times 0 5t 0
			execute as @e[tag=DENSITY] at @s if score #Density Frame matches 17 if entity @e[tag=SAVETHEM] if score @s ID = @e[tag=SAVETHEM,limit=1,sort=nearest] ID if score @s ID = @p ID run title @p title {"font":"ui","text":"\u0001"}
			execute as @e[tag=DENSITY] at @s if score #Density Frame matches 18 if entity @e[tag=SAVETHEM] if score @s ID = @e[tag=SAVETHEM,limit=1,sort=nearest] ID if score @s ID = @p ID run title @p title {"font":"ui","text":"\u0000"}
			execute as @e[tag=DENSITY] at @s if score #Density Frame matches 18 if entity @e[tag=SAVETHEM] if score @s ID = @e[tag=SAVETHEM,limit=1,sort=nearest] ID if score @s ID = @p ID run title @p times 0 1t 10t
	
	
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 18 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0018"}
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 19 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0019"}
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 20 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0020"}
	
	# [ Kill the player if he didnt do the objective ]
		execute as @e[tag=DENSITY] at @s if score #Density Frame matches 20 if score @s ID = @p ID at @p if entity @e[tag=SAVETHEM] if score @s ID = @e[tag=SAVETHEM,limit=1,sort=nearest] ID run kill @p
		
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 21 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0021"}
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 22 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0022"}
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 23 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0023"}
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 24 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0024"}
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 25 if score @s ID = @p ID run title @p title {"font":"density","text":"\u0025"}
	
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 26.. run scoreboard players set #Density_LOOP_1 Frame 0
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 26.. run scoreboard players set #Density_LOOP_2 Frame 0
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches 26.. run scoreboard players set #Density Frame -1
	
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches -1 if score @s ID = @p ID run stopsound @p * minecraft:music.overworld.sparse_jungle
	
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches -1 if score @s ID = @e[tag=SAVETHEM,sort=nearest,limit=1] ID run kill @e[tag=SAVETHEM,sort=nearest]
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches -1 if score @s ID = @e[tag=SAVETHEM.DISPLAY,sort=nearest,limit=1] ID run kill @e[tag=SAVETHEM.DISPLAY,sort=nearest]
	execute as @e[tag=DENSITY] at @s if score #Density Frame matches -1 run kill @s
	scoreboard players add #Density Frame 1
	
# [ LOOP ]
	execute if entity @e[tag=DENSITY] run schedule function main:entity/density/animation 1t
	